﻿using CaseManagerLibrary.Auth;
using MaterialSkin;
using MaterialSkin.Controls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EvidenceAssitant
{
    public partial class FrmMain : Form
    {
        UserLogin login = new UserLogin();

        public FrmMain()
        {
            InitializeComponent();
            this.WindowState = FormWindowState.Maximized;

            this.Controls.Add(login);
            login.SetTitle(Properties.Resources.title_evidenceassistant);
            login.Size = this.ClientSize;
            login.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
          | System.Windows.Forms.AnchorStyles.Left)
          | System.Windows.Forms.AnchorStyles.Right)));
            login.BringToFront();
            login.LoginSuccess += Login_LoginSuccess;
            login.LoginFail += Login_LoginFail;
        }

        private void Login_LoginFail(string msg)
        {
            MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }

        private void Login_LoginSuccess(CaseManagerLibrary.Models.ac_user user, object data)
        {
            login.Hide();
        }

        private void FrmMain_Shown(object sender, EventArgs e)
        {
            login.Show("");
        }
    }
}
